package ambika.exceptions;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Exceptions extends Exception{

	public Exceptions(String message){
		super(message);
	}
	public static int arrayOfNumbers() throws NullPointerException{
		int[] result = null;
	    int r = 0;
		try{
		 for(int i = 0; i <result.length;i++)
			 r = result[i];
		}
		catch(NullPointerException n){
			System.out.println("There are no objects in this array. How are we supposed to know what to return? " +n);
			n.printStackTrace();
		}
		return r;
	}
	public static FileInputStream readFile(File f) throws FileNotFoundException{
		FileInputStream fs = null;
		try{
			fs = new FileInputStream(f);
		}
		catch(FileNotFoundException e){
			System.out.println("Where is that file, "+ f+", on your computer? " + e);
			e.printStackTrace();
		}
		
		return fs;
	}
	
	
	
	public static void main(String[] args) throws FileNotFoundException{
		File f = new File("hello.txt");
		
		readFile(f);
		arrayOfNumbers();
	}
}
